<?php if(isset($_SESSION['user'])){ ?>
<?php $header=$this->action('Application\Controller\IndexController', 'headerAction',array('20','10'));
	  $baseUrl = $header->headerarray['baseUrl'];
	  $basePath = $header->headerarray['basePath'];
?>
<div class="container">
<div class="row">
<div class="span3">
		<div class="sub_header_left">
			<ul>
				<li>My Account</li>
			<?php if(isset($_SESSION['user'])){ ?>
			<li>
				<a href="<? echo $baseUrl;?>users/edit-user?user_id=<?php if(isset($_SESSION['user']['user_id'])){echo $_SESSION['user']['user_id'];}else{} ?>">Profile</a>
			</li>
			<li>
				<a href="<? echo $baseUrl;?>users/change-password">Change Password</a>
			</li>
			<?if($_SESSION['user']['user_type']=="user"){?>
			<li>
				<a href="<? echo $baseUrl;?>users/userorderview">Your Orders</a>
			</li>
			<? }else{?>
			<li><a href="<? echo $baseUrl;?>users/order-view">Online-Orders</a></li>
			<li><a href="<? echo $baseUrl;?>users/offline-order">Offline-orders</a></li>
			<?}?>
			<?php }?>
			<li><a href="#">Help Center</a></li>
			</ul>
		</div>
	</div>
<div class="span9">
<div class="well min_height">
		<div class="inner_title">
			<h3>Your Order History</h3>
		</div>
	<div class="main-content filter_pad" id="main-content">
		<div class="sub-content filter_select select_b">
				<div class="control-group">
						<div class="controls">
							<select id="ordertypeid" name="ordertypeid" onchange="return changeUserOrder('ordes')">
								<option value="">Select Order Type</option>
								<option value="online">online</option>
								<option value="offline">offline</option>
							</select>
							<select id="category" name="category" onchange="return getusergridsubcategories('user')">
								<option value="">select category</option>
								<? if($this->categoryAll->count()>0){ foreach($this->categoryAll as $category){ ?>
											<option value="<? echo $category->category_id;?>"><? echo $category->category_name;?></option>
											<?}}?>
							</select>
							
							<select id="subcategoryid" name="subcategoryid" onchange="return changeUserOrder('ordes')">
								<option value="">select sub category</option>
							</select>
						</div>
				</div>
		</div>
		<div class="product_table table-responsive">
		</div>	
	</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
$('.product_table').html('Please wait loading....');
	$.ajax({
		type:'GET',
		dataType:'json',
		url: BASE_PATH+'/users/userorderviewAjax',
		success: function(data){
		$('.product_table').html('<table  class="table table-bordered" cellpadding="0" cellspacing="0" width="100%" id="search_results"><thead><tr class="bg_header"><th>OrderId</th><th>Username</th><th>PhoneNumber</th><th>Amount</th><th>Offline/Online</th><th>PaymentStatus</th><th>OrderStatus</th><th>Action</th></tr></thead><tbody></tbody></table>');	
			if(data!='1'){
				eval(data);
				var oTable = $('#search_results').dataTable( {
					aoColumnDefs: [{bSortable: false,
									aTargets: [ 0 ]
									}],
					"bStateSave": true,
					"bAutoWidth": true,
					"sRowSelect": "multi",
					"sPaginationType": "full_numbers",
					"bProcessing": true,
					"aaData": data,
					"aoColumns": [
						{ "mData": "order_id" },
						{ "mData": "user_name" },
						{ "mData": "phone_number" },
						{ "mData": "amount" },						
						{ "mData": "admode" },						
						{ "mData": "payment_status" },						
						{ "mData": "order_status" },						
						{ "mData": "Action" }						
					] 
				});
			}else{
				$('.product_table').html('No Data is available...');	
			}					
		}
	});
});	
function cancelOrder(){
	alert('cancel order');return false;
}
</script>
<?php }else{?>
<script>
	window.location=BASE_URL;
</script>
<?php } ?>